package me.raih.service.impl;

import me.raih.mapper.MenuMapper;
import me.raih.pojo.po.Menu;
import me.raih.service.MenuService;
import me.raih.util.MenuUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @Author Raih
 * @Time 2020/11/26  14:29
 */
@Service
@Transactional
public class MenuServiceImpl implements MenuService {

    @Autowired
    MenuMapper menuMapper;




    @Override
    public List<Map<List<Menu>,List<Menu>>> menuChange() {

        List<Menu> allMenu = menuMapper.adminFindAllMenu();

        List<Map<List<Menu>,List<Menu>>> recombination = MenuUtil.recombination(allMenu);

        return recombination;
    }

    @Override
    public List<Map<List<Menu>, List<Menu>>> salesMenuChange() {

        List<Menu> menuList = menuMapper.salesFindAllMenu();
        List<Map<List<Menu>, List<Menu>>> recombination = MenuUtil.recombination(menuList);

        return recombination;
    }
}
